<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>가수 리스트 페이지</title>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
	$('#regslide').slideUp('fast');
	jQuery.noConflict();
	jQuery("#newSinger").click(function() {
		if(jQuery(this).attr('checked')){
			$('#regslide').slideDown('fast');
		}else{
			$('#regslide').slideUp('fast');
		}
	});
	jQuery.noConflict();
	jQuery("#Insertcancel").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		location.href= str+ "/mypageForm.mb";
	});
	
	jQuery.noConflict();
	jQuery("#Insertsub").click(function(){
		var idx = document.URL.indexOf("bigjo");
		var str = document.URL.substring(0, idx+5);
		var s_singer = jQuery("#singer").val();
		var s_gender = jQuery("#s_gender").val();
		var s_members = jQuery("#s_members").val();
		alert(s_singer+s_gender+s_members)
		jQuery.ajax({
			url : str+"/singerCheck.ha?s_singer="+s_singer,
			success : function(data) {
				alert("이미 등록된 가수 입니다.");
			},
			error: function(request,status,error){
				location.href=str+"/insertSinger.ha?s_singer="+s_singer+"&s_gender="+s_gender+"&s_members="+s_members;				
			}
		});
	});
	
});
</script>
</head>
<body>
	
	<input type="checkbox" name="newSinger" id="newSinger" value="new">등록 안된 이름<br>
	<table>
	<tr>
		<td>등록된 이름 :</td>
		<td></td>
	</tr>
	<c:forEach var="singer" items="${singerName}">
	<tr>
		<td></td>
		<td>${singer.s_singer }</td>
	</tr>
	</c:forEach>
	</table>
	<div id="regslide">
	<input type="hidden" id="s_singer" name="s_singer" value="${singer.s_singer }">
			<table align="center">
				<tr>
					<td></td>
					<td><span id="idresult"></span></td>
				</tr>
				<tr>
					<td align="right">성별</td>
					<td align="left"><select id="s_gender" name="s_gender">
							<option>남</option>
							<option>여</option>
							<option>혼성</option>
					</select></td>
				</tr>
				<tr>
					<td align="right">그룹</td>
					<td align="left"><select id="s_members" name="s_members">
							<option>솔로</option>
							<option>그룹</option>
					</select></td>
				</tr>
				<tr>
					<td></td>
					<td colspan="2">
						<input type="button" id="Insertsub"name="Insertsub" value="등록"> 
						<input type="button"id="Insertcancel" name="Insertcancel" value="취소">
					</td>
				</tr>
			</table>
		</div>
</body>
</html>